package com.bear.fastrepair.mvvm.ui.employee.dialog

import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import com.bear.fastrepair.base.BaseDialog
import com.bear.fastrepair.databinding.DialogCommonBinding

class CommonDialog(
    context: Context,
    private val title: String,
    private val itemClick: (String) -> Unit
) :
    BaseDialog(context) {
    private lateinit var binding: DialogCommonBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DialogCommonBinding.inflate(LayoutInflater.from(context))
        setContentView(binding.root)
        setCancelable(true)
        binding.title.text = title
        binding.confirm.setOnClickListener {
            val remarks = binding.remarks.text.toString()
            itemClick.invoke(if (remarks.isEmpty()) "无" else remarks)
            dismiss()
        }
    }
}